package gokyesil.game2d.actors;

import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.World;

public class MapFinish extends MapBlock 
{
	public MapFinish(ButtonStyle style, float x, float y, float diameter, World physWorld)
	{
		super(style, x, y, diameter, diameter, physWorld);	
	}
    public void setBody(float x, float y, World physWorld)
    {
    	BodyDef bodyDef = new BodyDef();
		bodyDef.type = BodyType.StaticBody;
		bodyDef.position.set(scale*(x+this.getWidth()/2), scale*(y+this.getHeight()/2));
	    this.body = physWorld.createBody(bodyDef);
	    
	    CircleShape circle = new CircleShape();
	    circle.setRadius(scale*getWidth()/2);
	    
	    FixtureDef fixtureDef = new FixtureDef();
	    fixtureDef.shape = circle;
	    fixtureDef.isSensor = true;
	    body.createFixture(fixtureDef);
    }
	public MapBlock clone(World newPhysWorld)
	{
		return new MapFinish(this.getStyle(),this.getX(),this.getY(),this.getWidth(),newPhysWorld);
	}
}
